#ifndef _DRV_CAN_H
#define _DRV_CAN_H

#include "drv_conf.h"
#include HAL_INCLUDE
#include "navigation.h"

#if MOTOR_CAN_ENABLE == 1

HAL_StatusTypeDef can_user_init(CAN_HandleTypeDef* hcan);

void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan);
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan);

typedef __packed struct
{
	uint8_t left;
	uint8_t right;
	int16_t ch0;
	int16_t ch1;
}rc_data_t;

typedef __packed struct
{
    uint8_t suggest_fire;
	uint8_t gimbal_reset_state;
	uint8_t time_to_stop;
	uint8_t time_to_go_r;
	uint8_t time_to_go_l;
	uint8_t time_to_spinning;
	int16_t yaw_err;
}gimbal_command_t;

void get_suggest_fire(uint8_t suggest_fire);
HAL_StatusTypeDef CAN_send_gimbal_command(CAN_HandleTypeDef* hcan,gimbal_command_t* tx_msg, uint32_t id);
HAL_StatusTypeDef CAN_send_RC(CAN_HandleTypeDef* hcan,rc_data_t* tx_msg, uint32_t id);
HAL_StatusTypeDef CAN_send_speed_ref(CAN_HandleTypeDef* hcan,rx_bag_send_to_chassis* tx_msg, uint32_t id);
void get_gimbal_reset_flag(uint8_t gimbal_reset);


#endif

#endif

